﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="PurchaseOrder_ShortClose.aspx.cs"
    Inherits="Main_Inventory_PurchaseOrder_ShortClose" %>

<%@ Register Src="~/User Controls/PageHeading.ascx" TagName="heading" TagPrefix="acc" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControl" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="Stylesheet" href="../../Styles/accounts.css" type="text/css" />
    <link href="../../Styles/HorizontalTab.css" rel="stylesheet" type="text/css" />
    <style type="text/css">
        .modalPopUpBackground
        {
            background-color: #E4E4E4;
            filter: alpha(opacity=40);
            opacity: 0.7;
            xindex: -1;
        }
        .PanelBg
        {
            background-image: -webkit-gradient(linear,left top,left bottom,color-stop(0, #A8FCB4),color-stop(0.77, #6AB638));
            background: #6AB638;
            background-image: -o-linear-gradient(bottom, #A8FCB4 0%, #6AB638 77%);
            background-image: -moz-linear-gradient(bottom, #A8FCB4 0%, #6AB638 77%);
            background-image: -webkit-linear-gradient(bottom, #A8FCB4 0%, #6AB638 77%);
            background-image: -ms-linear-gradient(bottom, #A8FCB4 0%, #6AB638 77%);
            background-image: linear-gradient(to bottom, #A8FCB4 0%, #6AB638 77%);
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="SEM" runat="server">
        </asp:ScriptManager>
        <acc:heading ID="pagehead" runat="server" HeadingText="Purchase Order Short Close" />
        <div style="margin-left: 40%;">
            <asp:Label ID="lblmsg" runat="server"></asp:Label>
        </div>      
        <script type="text/javascript">
            function divExpandCollapse(divname) {
                var div = document.getElementById(divname);
                var img = document.getElementById('img' + divname);
                if (div.style.display == "none") {
                    div.style.display = "inline";
                    img.src = "../../Menu/images/minus.gif";
                }
                else {
                    div.style.display = "none";
                    img.src = "../../Menu/images/plus.gif";
                }
            }
        </script>  
        <asp:UpdatePanel ID="updategrid" runat="server">
            <ContentTemplate>
                <asp:Panel ID="PoShortClose" runat="server" Visible="false" Style="margin-left: 1%; margin-top:10px;">
                    <asp:GridView ID="grdposhortclose" runat="server"
                        AutoGenerateColumns="false" DataKeyNames="POID" CssClass="gridview" Width="99%"
                        OnRowDataBound="grdposhortclose_RowDataBound">
                        <Columns>
                            <asp:TemplateField HeaderText="S.No" ItemStyle-Width="10px">
                                <ItemTemplate>
                                    <%# Container.DataItemIndex + 1 %>
                                    <a href="Javascript:divExpandCollapse('div<%# Eval("PONO") %>');">
                                        <img id="imgdiv<%#Eval("PONO") %>" width="9px" border="0" src="../../Menu/images/plus.gif" />
                                    </a>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Short Close" ItemStyle-Width="50px">
                                <ItemTemplate>
                                    <asp:HiddenField ID="hidPOID" runat="server" Value='<%#Bind("POID")%>' />
                                    <asp:CheckBox ID="chkshortclose" runat="server" Checked='<%#Eval("ShortClose")%>'
                                        AutoPostBack="true" OnCheckedChanged="chkshortclose_CheckedChanged" />                                    
                                    <AjaxControl:ModalPopupExtender ID="MPE" runat="server" PopupControlID="pnlPoRemarks"
                                       BackgroundCssClass="modalPopUpBackground" TargetControlID="hidPOID">
                                    </AjaxControl:ModalPopupExtender>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="PO No" ItemStyle-Width="130px">
                                <ItemTemplate>
                                    <asp:Label ID="lblPoNo" runat="server" Text='<%#Bind("PONO")%>'></asp:Label>                                    
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="PODate" HeaderText="PO Date" DataFormatString="{0:dd/MM/yyyy}" />
                            <asp:BoundField DataField="ShortCloseDate" NullDisplayText="-" HeaderText="PO Short Close Date" DataFormatString="{0:dd/MM/yyyy}" />
                            <asp:BoundField DataField="shortClose_Remark" NullDisplayText="-" HeaderText="Remark" />
                            <asp:BoundField DataField="VenderName" HeaderText="Supplier Name"/>
                            <asp:BoundField DataField="DeliveryDate" HeaderText="Delivery Date" DataFormatString="{0:dd/MM/yyyy}" />
                            <asp:BoundField DataField="TotalQty" HeaderText="Item Qty" DataFormatString="{0:00}" ItemStyle-HorizontalAlign="Right"/>
                            <asp:BoundField DataField="GrandTotal" HeaderText="Total Amount" DataFormatString="{0:00.00}" ItemStyle-HorizontalAlign="Right"/>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <tr>
                                        <td colspan="100%">
                                            <div id="div<%# Eval("PONO") %>" style="display:none; position:relative;left:15px; overflow:auto">
                                                <asp:GridView ID="gvPOShortChild" runat="server" CssClass="gridview" AutoGenerateColumns="false" Width="96%">                                                    
                                                    <Columns>
                                                        <asp:TemplateField HeaderText="S.No">
                                                            <ItemTemplate>
                                                                <%# Container.DataItemIndex+1 %>
                                                            </ItemTemplate>
                                                        </asp:TemplateField>
                                                        <asp:BoundField DataField="ItemCode" HeaderText="Item Code" />
                                                        <asp:BoundField DataField="ItemName" HeaderText="Item Name" />
                                                        <asp:BoundField DataField="ItemQty" HeaderText="Item Qty" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:0}" />
                                                        <asp:BoundField DataField="ItemReceive" HeaderText="Item Receive" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:0}" />                                                        
                                                        <asp:BoundField DataField="BalanceItem" HeaderText="Balance Item Qty" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:0}" />
                                                    </Columns>
                                                </asp:GridView>
                                            </div>
                                        </td>
                                    </tr>
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <asp:Panel ID="pnlPoRemarks" CssClass="PanelBg" Width="30%" BorderWidth="17" BorderStyle="Solid"
                        BorderColor="White" runat="server">
                        <table width="100%">
                            <tr>
                                <td colspan="4">
                                    <div style="position: relative; top: -18px; left: 95%; width: 17px;">
                                        <asp:LinkButton ID="btnCancel" runat="server" Text="Close" 
                                            OnClientClick="Cleartextbox();" onclick="btnCancel_Click" />
                                        <asp:HiddenField ID="hidrowid" runat="server" />
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4">                                
                                    Remark For Purchase Order Short Close
                                </td>                                
                            </tr>
                            <tr>
                                <td>
                                    &nbsp;
                                </td>
                                <td colspan="2">
                                    <asp:TextBox ID="txtremarks" runat="server" TextMode="MultiLine" Width="260px" Height="80px"></asp:TextBox>
                                </td>
                                <td>
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4" align="center">
                                    <asp:Button ID="btnShortClose" runat="server" Text="Save" CssClass="button" OnClick="btnShortClose_Click" />
                                    <script type="text/javascript">
                                        function Checktext() 
                                        {
                                            if (document.getElementById("txtremarks").value == "") 
                                            {
                                                alert("Please Enter The Remark for Short Close.");
                                                document.getElementById("txtremarks").focus();
                                                return false;
                                            }
                                        }
                                        function Cleartextbox() 
                                        {
                                            document.getElementById("txtremarks").value = '';
                                        }
                                    </script>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </asp:Panel>               
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>
